/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BUS;

import DAO.AccountMailDAO;
import DTO.AccountMailDTO;
import java.sql.SQLException;
import java.util.ArrayList;

/**
 *
 * @author NxSiHMr0D
 */
public class AccountMailBUS {

    AccountMailDAO _tmp = new AccountMailDAO();

    /**
     * get account mail from name.
     * @param name
     * @return
     * @throws java.sql.SQLException
     */
    public AccountMailDTO getAccountMail(String name) throws SQLException {
        return _tmp.getAccountMail(name);
    }

    /**
     * get all of account mail
     * @return
     * @throws java.sql.SQLException
     */
    public ArrayList<AccountMailDTO> getListAccount() throws SQLException {

        return _tmp.getListAccount();

    }

    /**
     * get account mail by id
     * @param id
     * @return
     * @throws java.sql.SQLException
     */
    public AccountMailDTO getAccountMail(int id) throws SQLException {
        return _tmp.getAccountMail(id);

    }

    /**
     * get account mail by sender
     * @param sender
     * @return
     * @throws java.sql.SQLException
     */
    public AccountMailDTO getMailFromAddress(String sender) throws SQLException {
        //throw new UnsupportedOperationException("Not yet implemented");
        return _tmp.getMailFromAddress(sender);
    }

    /**
     * update information of account mail
     * @param accountUpdate
     * @throws java.sql.SQLException
     */
    public void updateAccountMail(AccountMailDTO accountUpdate) throws SQLException {
        _tmp.updateAccountMail(accountUpdate);
    }

    /**
     * insert new account mail
     * @param accountInsert
     * @return
     * @throws java.sql.SQLException
     */
    public int insertAccountMail(AccountMailDTO accountInsert) throws SQLException {
        return _tmp.insertAccountMail(accountInsert);
    }

    /**
     * delete exist account from database.
     * @param accountDelete
     * @throws java.sql.SQLException
     */
    public void deleteAccountMail(AccountMailDTO accountDelete) throws SQLException {
        _tmp.deleteAccountMail(accountDelete);
    }
}
